package com.grpcclient.goods;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.34.1)",
    comments = "Source: goods.proto")
public final class GoodsGrpc {

  private GoodsGrpc() {}

  public static final String SERVICE_NAME = "com.grpcclient.goods.Goods";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<com.grpcclient.goods.GoodsId,
      com.grpcclient.goods.GoodsInfoList> getGetGoodsListMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "getGoodsList",
      requestType = com.grpcclient.goods.GoodsId.class,
      responseType = com.grpcclient.goods.GoodsInfoList.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<com.grpcclient.goods.GoodsId,
      com.grpcclient.goods.GoodsInfoList> getGetGoodsListMethod() {
    io.grpc.MethodDescriptor<com.grpcclient.goods.GoodsId, com.grpcclient.goods.GoodsInfoList> getGetGoodsListMethod;
    if ((getGetGoodsListMethod = GoodsGrpc.getGetGoodsListMethod) == null) {
      synchronized (GoodsGrpc.class) {
        if ((getGetGoodsListMethod = GoodsGrpc.getGetGoodsListMethod) == null) {
          GoodsGrpc.getGetGoodsListMethod = getGetGoodsListMethod =
              io.grpc.MethodDescriptor.<com.grpcclient.goods.GoodsId, com.grpcclient.goods.GoodsInfoList>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "getGoodsList"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.grpcclient.goods.GoodsId.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.grpcclient.goods.GoodsInfoList.getDefaultInstance()))
              .setSchemaDescriptor(new GoodsMethodDescriptorSupplier("getGoodsList"))
              .build();
        }
      }
    }
    return getGetGoodsListMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static GoodsStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<GoodsStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<GoodsStub>() {
        @java.lang.Override
        public GoodsStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new GoodsStub(channel, callOptions);
        }
      };
    return GoodsStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static GoodsBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<GoodsBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<GoodsBlockingStub>() {
        @java.lang.Override
        public GoodsBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new GoodsBlockingStub(channel, callOptions);
        }
      };
    return GoodsBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static GoodsFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<GoodsFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<GoodsFutureStub>() {
        @java.lang.Override
        public GoodsFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new GoodsFutureStub(channel, callOptions);
        }
      };
    return GoodsFutureStub.newStub(factory, channel);
  }

  /**
   */
  public static abstract class GoodsImplBase implements io.grpc.BindableService {

    /**
     */
    public void getGoodsList(com.grpcclient.goods.GoodsId request,
        io.grpc.stub.StreamObserver<com.grpcclient.goods.GoodsInfoList> responseObserver) {
      asyncUnimplementedUnaryCall(getGetGoodsListMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getGetGoodsListMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                com.grpcclient.goods.GoodsId,
                com.grpcclient.goods.GoodsInfoList>(
                  this, METHODID_GET_GOODS_LIST)))
          .build();
    }
  }

  /**
   */
  public static final class GoodsStub extends io.grpc.stub.AbstractAsyncStub<GoodsStub> {
    private GoodsStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected GoodsStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new GoodsStub(channel, callOptions);
    }

    /**
     */
    public void getGoodsList(com.grpcclient.goods.GoodsId request,
        io.grpc.stub.StreamObserver<com.grpcclient.goods.GoodsInfoList> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getGetGoodsListMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class GoodsBlockingStub extends io.grpc.stub.AbstractBlockingStub<GoodsBlockingStub> {
    private GoodsBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected GoodsBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new GoodsBlockingStub(channel, callOptions);
    }

    /**
     */
    public com.grpcclient.goods.GoodsInfoList getGoodsList(com.grpcclient.goods.GoodsId request) {
      return blockingUnaryCall(
          getChannel(), getGetGoodsListMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class GoodsFutureStub extends io.grpc.stub.AbstractFutureStub<GoodsFutureStub> {
    private GoodsFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected GoodsFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new GoodsFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.grpcclient.goods.GoodsInfoList> getGoodsList(
        com.grpcclient.goods.GoodsId request) {
      return futureUnaryCall(
          getChannel().newCall(getGetGoodsListMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_GET_GOODS_LIST = 0;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final GoodsImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(GoodsImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_GET_GOODS_LIST:
          serviceImpl.getGoodsList((com.grpcclient.goods.GoodsId) request,
              (io.grpc.stub.StreamObserver<com.grpcclient.goods.GoodsInfoList>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class GoodsBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    GoodsBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.grpcclient.goods.GoodsSer.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("Goods");
    }
  }

  private static final class GoodsFileDescriptorSupplier
      extends GoodsBaseDescriptorSupplier {
    GoodsFileDescriptorSupplier() {}
  }

  private static final class GoodsMethodDescriptorSupplier
      extends GoodsBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    GoodsMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (GoodsGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new GoodsFileDescriptorSupplier())
              .addMethod(getGetGoodsListMethod())
              .build();
        }
      }
    }
    return result;
  }
}
